#include <QtGui>
//#include <QVBoxLayout>
//#include <QVBoxLayout>

#include "space.h"
#include "mainwindow.h"

MainWindow::MainWindow() {
    world = new World();
    
    space = new Space(0, world);
    space -> resize(500, 500);   
    
    world -> addParticle(10, 10, 100);
    world -> addParticle(500, 500, -100);
    
    thread = new UpdateThread(world, space);
    
    simulateButton = new QPushButton("Simulate");
    simulateButton -> setCheckable(true);
    connect(simulateButton, SIGNAL(toggled(bool)), thread, SLOT(setSimulate(bool)));
    addButton = new QPushButton("Add");
    connect(addButton, SIGNAL(released()), this, SLOT(add()));
    removeButton = new QPushButton("Remove");
    connect(removeButton, SIGNAL(released()), this, SLOT(remove()));
    
    QToolBar * bar = new QToolBar("Control");
    bar -> addWidget(simulateButton);
    bar -> addWidget(addButton);
    bar -> addWidget(removeButton);
    addToolBar(bar);
    setCentralWidget(space);
    
    
}

void MainWindow::add() {

}

void MainWindow::remove() {

}
